<?php
/*
 *author:Yangligao
 *Date:2013-10-4
 */

require '../../Config.php';
$flag = $_GET['flag'];

if($flag == 'display'){
	
	$smarty->display('Admin/Menu/menuinsert.html');
}else if($flag == 'menuinsert'){

	//使用上传类处理图像
	$upload = new Upload();
	$picPath = $upload->savePic('../Upload/menu');
	$arr['menu_pic'] = $picPath;
	$arr['menu_name'] = $_POST['menu_name'];
	$arr['menu_content'] = $_POST['menu_content'];
	$arr['menu_count'] = 0;
	$arr['menu_good'] = 0;
	$arr['menu_bad'] = 0;
	
	$menuModel = new MenuModel();
	
	$res = $menuModel->menu_insert($arr);
	if($res){
		jump('操作成功！', $_SERVER['HTTP_REFERER']);
	}else{
		alertInfo('操作失败！！', $_SERVER['HTTP_REFERER']);
	}
}
?>
